/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.za.cput.kleintjes.question3.dip.violates.services.impl;

import ac.za.cput.kleintjes.question3.dip.violates.services.TransactionDestination;
import ac.za.cput.kleintjes.question3.dip.violates.services.TransactionSource;

/**
 * @author Hughan.Kleintjes.hughanK@gmail.com
 */
public class Transaction implements TransactionSource, TransactionDestination{

    private TransactionSource sourceAccount;
    private TransactionDestination destinationAccount;
    private double value;

    public void Transfer() {
        sourceAccount.fundDeduction(value);
        destinationAccount.fundAddition(value);
    }

    public TransactionDestination getDestinationAccount() {
        return destinationAccount;
    }

    public void setDestinationAccount(TransactionDestination destinationAccount) {
        this.destinationAccount = destinationAccount;
    }

    public TransactionSource getSourceAccount() {
        return sourceAccount;
    }

    public void setSourceAccount(TransactionSource sourceAccount) {
        this.sourceAccount = sourceAccount;
    }

    public double getValue() {
        return value;
    }

    public void setValue(double value) {
        this.value = value;
    }

    @Override
    public void fundDeduction(double values) {
        sourceAccount.fundDeduction(values);
    }

    @Override
    public void fundAddition(double values) {
        destinationAccount.fundAddition(values);
    }
        
}